<?php
/**
 * 直播api公共控制器
 * @author martinsun syh@sunyonghong.com
 */
 
namespace app\common\controller;
use app\common\controller\Api;
require_once (join(DIRECTORY_SEPARATOR, array(dirname(__DIR__), 'vendor','zhibo', 'Pili.php')));
class Zhibo extends Api
{
    /**
     * @name 获得HUB的方法
     * @access protected
     * @return object HUB 类
     */
    protected function getHub(){
        // Instantiate an Hub object
        $stream_service = model('admin/Config')->getConfigValue(['type'=>'stream','key'=>'stream_service']);
        $credentials = new \vendor\zhibo\Qiniu\Credential($stream_service['qiniu_accessKey'],$stream_service['qiniu_secretKey']); #=> Credentials Object
        //get new hub
        //$config_hub = end(C('qiniu_hub'));
        $config_hub = $stream_service['hub_name'];
        return new \vendor\zhibo\Pili\Hub($credentials, $config_hub); # => Hub Object
    }
}
